package com.jie.deletefile.PullToZoomListView;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.jie.deletefile.R;

import java.util.List;

/**
 * Created by Administrator on 2016/11/30 0030.
 */
public class PullAdapter extends BaseAdapter {

    private Context context;
    private List<String> datas;
    private int resID;

    public PullAdapter(Context context, List<String> datas, int resID) {
        this.context = context;
        this.datas = datas;
        this.resID = resID;
    }

    @Override
    public int getCount() {
        return datas.size();
    }

    @Override
    public Object getItem(int position) {
        return datas.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if (convertView == null) {
            convertView = LayoutInflater.from(context).inflate(resID, null);
        }
        TextView textView = (TextView) convertView.findViewById(R.id.tv_pull);
        textView.setText(datas.get(position));
        return convertView;
    }

}
